import * as vscode from 'vscode';


import YapiWebviewProvider from './yapiWebviewProvider';


export function registerView(context: vscode.ExtensionContext) {
  const provider = new YapiWebviewProvider(context.extensionUri);

  context.subscriptions.push(
    vscode.window.registerWebviewViewProvider(YapiWebviewProvider.viewType, provider)
  );

  context.subscriptions.push(
    vscode.commands.registerCommand('zd-vscode-tools.getKey', async (key: string) => {
      const value = context.globalState.get<string>('exampleKey');

      vscode.window.showInformationMessage(`Loaded global state: ${value}`);
    })
  );

  context.subscriptions.push(
    vscode.commands.registerCommand('zd-vscode-tools.setKey', async (key: string, value:string) => {
      await context.globalState.update(key, value);
      vscode.window.showInformationMessage('Global state saved!');
    })
  );

}


